package com.xbongbong.saas.model.impl;

import com.xbongbong.pro.domain.dao.SaasProRelationDao;
import com.xbongbong.pro.domain.entity.SaasProRelationEntity;
import com.xbongbong.saas.model.SaasProRelationModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * saas和pro的id对应关系
 * 创建时间 2019/7/14 5:13 PM
 * 修改时间 2019/7/14 5:13 PM
 * @author chy
 * @since v1.0
 * @version v1.0
 */
@Service("saasProRelationModel")
public class SaasProRelationModelImpl implements SaasProRelationModel {

    @Resource
    private SaasProRelationDao saasProRelationDao;

    @Override
    public Integer insert(SaasProRelationEntity entity) {
        return saasProRelationDao.insert(entity);
    }

    @Override
    public void insertBatch(List<SaasProRelationEntity> list) {
        saasProRelationDao.insertBatch(list);
    }

    @Override
    public Integer update(SaasProRelationEntity entity) {
        return saasProRelationDao.update(entity);
    }

    @Override
    public Integer save(SaasProRelationEntity entity) {
        if(entity.getId() == null || Objects.equals(0L, entity.getId())) {
            return saasProRelationDao.insert(entity);
        }
        return saasProRelationDao.update(entity);
    }

    @Override
    public Integer deleteByKey(Long key) {
        return saasProRelationDao.deleteByKey(key);
    }

    @Override
    public SaasProRelationEntity getByKey(Long key) {
        return saasProRelationDao.getByKey(key);
    }

    @Override
    public List<SaasProRelationEntity> findEntitys(Map<String ,Object> param) {
        return saasProRelationDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String ,Object>  param) {
        return saasProRelationDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }
}
